/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package im.node;

import im.clusterhead.ClusterHeadSubscription;
import im.eventservice.EventServiceSubscription;
import im.general.BaseNodeInfo;
import im.resources.ResourceStatus;
import im.resources.model.ResourcesModel;
import im.subscriptionpackage.ContentSubscription;

/**
 *
 * @author brownstone
 */
public class MobileNodeInfo extends BaseNodeInfo {
 /*   protected ContentSubscription contentSubscription = null;
    protected TopicSubscription topicSubscription = null;
    protected TypeSubscription typeSubscription = null;
*/
    
    //EventServiceSubscription ESSubscription;
    //ClusterHeadSubscription CHSubscription;


    protected ContentSubscription contentSubscription = null;
    private String nodeName;
    private String CHName;

    public MobileNodeInfo( String nd_name, String ch_name, ResourceStatus rs_stats, String cont_name ) {
        this.nodeName = nd_name;
        this.CHName = ch_name;
        this.setResourceStatus (rs_stats);
        this.setContainerName(cont_name);
    }

    public String getCh_name() {
        return CHName;
    }

    public ContentSubscription getContentSubscription() {
        return contentSubscription;
    }

    public void setContentSubscription(ContentSubscription subscription) {
        this.contentSubscription = subscription;
    }
    

    public void updateResourceStatus(ResourcesModel rm) {
        this.resourceStatus.updateStatus(rm);
    }
    public void setCh_name(String ch_name) {
        this.CHName = ch_name;
    }

    public String getNode_name() {
        return nodeName;
    }

    // Warning use only for logggin purpose
    // exact match not assured
    public String getNode_localname() {
        return nodeName.split("@")[0];
    }

    public void setNode_name(String node_name) {
        this.nodeName = node_name;
    }

    public boolean hasMoreResources(MobileNodeInfo info) {
        if(info!=null && info.resourceStatus.isBetter(this.resourceStatus))
            return true;
        else
            return false;
    }
}